package com.community.backend.controller;

import com.community.backend.utils.RedisUtils;
import com.community.backend.utils.Result;
import lombok.extern.slf4j.Slf4j;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.Set;

@Slf4j
@RestController
@RequestMapping("/show")
public class ShowController {


    //在线用户与总用户    未完成
    @GetMapping("/onlineAndAll")
    public Result onlineAndAll(){
        log.info(">>> 获取在线用户与总用户");
        String onlineKey = "login:USER";
        Set<Object> onlineUsers = RedisUtils.redis().opsForSet().members(onlineKey);
        log.info("在线用户：{}", onlineUsers);
        return Result.success();
    }
}
